package com.ecommerce.dal.common;

import com.ecommerce.dal.entity.Company;
import com.ecommerce.dal.entity.Item;
import com.ecommerce.dal.service.impl.CompanyManagerService;
import com.ecommerce.dal.service.impl.ItemManagerService;

public class TestCompany {
	
	public TestCompany(CompanyManagerService companyManagerService , ItemManagerService itemManagerService){
		
		
		/** insert **/
		
		Company company = new Company();
		//company.setCompanyId(1L);
		company.setCompanyName("Fizer");
		companyManagerService.saveCompany(company);
		
		/** select **/
    	Company company2 = companyManagerService.retrieveCompany(1L);
    	System.out.println(company2);
    	
    	/** update **/
    	company2.setCompanyName("Addidas");
    	companyManagerService.updateCompany(company2);
    	System.out.println(company2);
//    	
    	
    	Item item = itemManagerService.retrieveItem(1L);
    	Company company3 = companyManagerService.retrieveCompanyByItem(item.getItemId());
    	System.out.println("Company of first item is : " + company3.getCompanyName());

    	/** delete **/
//    	companyManagerService.delete(company2);
    	
    	System.out.println("Done");
	}

}
